/**
* Copyright (c) 2016-2100 yunclouds
*/
package com.yunqian.redot.domain;

import com.yunqian.model.BaseModel;
import com.yunqian.redot.constant.Tables;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 客户课程报名记录
 *
 * @author zsy
 * 2018-09-29 15:54:11
 */
@Data
@Entity
@Table(name = Tables.COURSES_ORDER)
@EqualsAndHashCode(callSuper = false)
public class CoursesOrder extends BaseModel<Long>{
    
    /**状态*/
    @Column(name = "status")
    private Integer status = 1;
    /**备注*/
    @Column(name = "remark")
    private String remark;
    /**排序号*/
    @Column(name = "sort_num")
    private Integer sortNum;
    /**订单号*/
    @Column(name = "order_no")
    private String orderNo;
    /**客户id*/
    @Column(name = "customer_id")
    private Long customerId;
    /**票价*/
    @Column(name = "price")
    private BigDecimal price;
    /**付款时间*/
    @Column(name = "pay_time")
    private Date payTime;
    /**关联课程id*/
    @Column(name = "course_id")
    private Long courseId;
    /**报名人姓名*/
    @Column(name = "name")
    private String name;
    /**报名人手机号*/
    @Column(name = "phone")
    private String phone;
    /**报名人邮箱*/
    @Column(name = "email")
    private String email;
    /**工作单位*/
    @Column(name = "company")
    private String company;
    /**职业*/
    @Column(name = "profession")
    private String profession;
    /**省粉*/
    @Column(name = "province")
    private String province;
    /**城市*/
    @Column(name = "city")
    private String city;
    /**区县*/
    @Column(name = "county")
    private String county;
    /**街道地址*/
    @Column(name = "address")
    private String address;
    /**性别 1男 2女*/
    @Column(name = "sex")
    private Integer sex;
    /**年龄 */
    @Column(name = "age")
    private Integer age;

    @ManyToOne
    @JoinColumn(name = "course_id", referencedColumnName = "id", insertable = false, updatable = false)
    @Fetch(FetchMode.SELECT)
    @NotFound(action=NotFoundAction.IGNORE)
    public Courses courses;

    public CoursesOrder() {
    }

}
